package com.bootx.service.impl;

import com.bootx.dao.WriteToolCategoryDao;
import com.bootx.entity.WriteToolCategory;
import com.bootx.service.WriteToolCategoryService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

/**
 * @author black
 */
@Service
public class WriteToolCategoryServiceImpl extends BaseServiceImpl<WriteToolCategory,Long> implements WriteToolCategoryService {

    @Resource
    private WriteToolCategoryDao writeToolCategoryDao;

    @Override
    public WriteToolCategory create(String name) {
        WriteToolCategory name1 = writeToolCategoryDao.find("name", name);
        if (name1 == null) {
            WriteToolCategory writeToolCategory = new WriteToolCategory();
            writeToolCategory.setName(name);
            super.save(writeToolCategory);
            return writeToolCategory;
        }
        return name1;
    }
}
